#define CAM_CTRL_BASEADDR   0x43C00000
#define SENSOR_RESET        0x00
#define LVDSRX_RESET        0x01
#define LVDSRX_TRAIN        0x02
#define TRIG_SOURCE         0x03
#define TRIG_PERIOD         0x04
#define EXP_TIME            0x05
#define DES_PORT            0x06
#define DES_IP              0x07
#define SRC_IP              0x08
#define DES_MAC_H           0x09
#define DES_MAC_L           0x0A
#define GVSP_RST            0x0B
#define STREAM_EN           0x0C

#define SIZE_Y              0x0D
#define NUM_PKT             0x0E
#define SIZE_PKT            0x0F
#define SIZE_PKT_LAST       0x10
#define OFFSET              0x11
#define GAIN                0x12
#define IMG_STREAM_RST      0x13
#define FIFO_RST            0x14
#define SRC_MAC_H           0x15
#define SRC_MAC_L           0x16
#define TRIG_ACT            0x17
#define TRIG_ENC            0x18
#define LED_GREEN           0x19
#define LED_RED             0x1A
#define TDI_LINE            0x1B
#define FLIP_H              0x1C
//////////////////////////////////////////////////////////////
#define CAM_STATUS_BASEADDR 0x43C10000
#define DMA_INTR            0x00
//////////////////////////////////////////////////////////////
#define FPN_COE_BASEADDR    0x40000000
#define PRNU_COE_BASEADDR   0x42000000
#define MES_DATA_BASEADDR   0x44000000
//////////////////////////////////////////////////////////////
#define TRIG_SRC_INT        0x00
#define TRIG_SRC_EXT        0x01
#define TRIG_SRC_ENC        0x02
#define TRIG_OFF            0x03

#define TRIG_ACT_RISE       0x00
#define TRIG_ACT_FALL       0x01
#define TRIG_ACT_ANY        0x02

#define TRIG_ENC_ANY        0x00
#define TRIG_ENC_FOR        0x01
#define TRIG_ENC_REV        0x02

void axi_write_reg(unsigned int base_addr, unsigned int offset_addr, unsigned int reg_value);
unsigned int axi_read_reg(unsigned int base_addr, unsigned int offset_addr);

void set_remote_port(unsigned int port);
void set_local_ip(char* m_szLocalIp);
void set_local_mac();
void set_remote_ip_mac(char* m_szRemoteIp);
void set_img_h(unsigned int img_h);
void set_pkt(unsigned int size_pkt, unsigned int img_h);

void set_trig_source(unsigned int trig_source);
void set_line_rate(unsigned int trig_freq_hz);
void set_exp_time(unsigned int exp_time_us);
void set_gain(unsigned int gain);
void set_offset(unsigned int offset);
void fpn_reset();
void prnu_reset();
void fpn_set();
void prnu_set();
void fpn_load();
void prnu_load();
void set_tdi(unsigned int line);
void set_x_rev(unsigned int flip_h);

void set_trig_act(unsigned int act);
void set_enc_mod(unsigned int mod);


void cam_init();
void dma_init(unsigned int img_h);